import { Component, OnInit, Input } from '@angular/core';
import { AppGlobalService } from '../../shared/service/app-global.service';

@Component({
  selector: 'app-business-summary',
  templateUrl: './business-summary.component.html',
  styleUrls: ['./business-summary.component.scss'],
})
export class BusinessSummaryComponent implements OnInit {

  @Input() tagData;
  firstData: any;
  constructor(
    private appGlobalService: AppGlobalService) { }

  ngOnInit() {
    if (this.tagData.data && this.tagData.data[0] !== undefined) {
      this.firstData = this.tagData.data[0];
    }
  }

  go() {
    if (this.tagData && this.tagData.data && this.tagData.data[0] && this.tagData.data[0].link) {
      const params = {
        pageId: this.tagData.data[0].link.target,
        params: this.tagData.data[0].link.params,
        sessionId: localStorage.getItem('sessionId')
      };
      this.appGlobalService.goToForward(params);

    }

  }

}
